package com.friend.entity.config;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @program: friend->HystrixRegistrationConfig
 * @description: HystrixRegistrationConfig
 * @author: yangzhanghui
 * @create: 2019-09-04 11:21
 **/
@Configuration
public class HystrixRegistrationConfig {
    @Bean(name = "hystrixRegistrationBean")
    public ServletRegistrationBean servletRegistrationBean() {
        ServletRegistrationBean registration = new ServletRegistrationBean(
                new HystrixMetricsStreamServlet(), "/actuator/hystrix.stream");
        registration.setName("hystrixServlet");
        registration.setLoadOnStartup(1);
        System.setProperty("es.set.netty.runtime.available.processors", "false");
        return registration;
    }
}
